
#ifndef CONTROLLER_MEMBER_H
#define CONTROLLER_MEMBER_H

#include <vector>

#include "mvc/mycontroller.h"
#include "gui/model_member.h"

class ControlMember : public MyController {

  public:
    // ------------------ virtual -------------------- //
    virtual void processEvent(ALLEGRO_EVENT* ev) {
        if(ev->type == ALLEGRO_EVENT_MOUSE_AXES) {
            Point point;
            point.setX((double)ev->mouse.x);
            point.setY((double)ev->mouse.y);
            ((ModelMember*)model)->setPoint2(point);
            MASTER->needRedraw();
        }
        else if(ev->type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) {
            Point point;
            point.setX((double)ev->mouse.x);
            point.setY((double)ev->mouse.y);
            ((ModelMember*)model)->setPoint2(point);

            if(this == MASTER->getFirstResponder()) {
                MASTER->setFirstResponder(parent);
            }
            MASTER->needRedraw();
        }
    }

    virtual bool insideMe(int x, int y) {
        /*  insert code here to determine if event occured inside this
            controller's view */

        return true;
    }
};

#endif


